// .txt

beginzonescript;

variables;

short im_hostile = 0;
short last_abil;
short counter = 0;
short set_ter1 = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_name(1612,"Xandrof");

	set_name(1634,"Wriggling Slime");
		set_name(1635,"Wriggling Slime");
		set_name(1636,"Wriggling Slime");
		set_name(1637,"Wriggling Slime");
		set_name(1638,"Wriggling Slime");

	set_name(1649,"Slimemaster");
	set_boss_level(1649,1);
	set_attack_range(1649,3);

//	add_ability(short which_char_or_group,short which_slot,short which_ability,0);

//	if (is_town_clear(ME))
//		clean_up_town();

	if (gf(16,11) == 0)
		sf(16,2,0);

	sf(16,16,0);
	sf(16,15,0);
	
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((set_ter1 == 0) && (gf(16,1) > 0)) {
		set_ter1 = 1;
		set_terrain(0,25,47,118);
		set_terrain(0,25,48,118);
		set_terrain(0,25,49,118);
		set_terrain(0,26,47,118);
		set_terrain(0,26,48,118);
		set_terrain(0,26,49,118);
		}
		
	if (gf(16,11) == 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1612,"Mind your feet.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1612,"The ground burns us.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1612,"Trader Shohre talks for us.");
		}
	if (gf(16,11) > 0) {
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1612,"The slime recedes.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1612,"Trader Shohre can reward you.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(1612,"Things will be bad again.");
		}

	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(1608 + get_ran(1,0,3),"Chop!");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(1608 + get_ran(1,0,3),"Chop! Chop!");

	if ((gf(16,11) == 0) && (is_talking() == FALSE) && (char_ok(1640) == FALSE) && (char_ok(1641) == FALSE) && (char_ok(1642) == FALSE)) {
		clear_town(ME);
		sf(16,11,1);
		begin_talk_mode(18);
		}
		
	//if (gf(,) < 2) {
	//	inc_flag(,,1);
	//	if (gf(,) == 2)
	//		begin_talk_mode();
	//	}

	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_town()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
		last_abil = get_current_tick();
		
		if (gf(16,15) > 0)
			inc_flag(16,15,-1);
		if (gf(16,16) > 0)
			inc_flag(16,16,-1);
		}
break;

beginstate 10;
	sf(16,20,1);
break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

//	print_str("");
//	set_terrain_string_range(".",1);
//	set_terrain_string_range("The sign says - .",1);
